package cn.tk.model.pojo.mr.flow;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * Created by denglw on 2021/7/15.<br/>
 * Desc: 文本话术详情
 */
@Data @NoArgsConstructor
public class TextReplyDetail {

    private Long detailId;

    /**
     * 话术id
     */
    private Long replyId;

    /**
     * 类型 1句子、2变量 3实体
     */
    private Integer type;

    /**
     * 内容类型 0纯文本、1富文本
     */
    private Integer contentType;

    /**
     * 当type=1时，具体的话术内容
     */
    private String content;

    /**
     * type=2时，对应变量id
     */
    private Long variableId;

    /**
     * type=2时，对应变量的英文名
     */
    private String variableEnName;

    /**
     * 变type=2时，变量值
     */
    private String variable;

    /**
     * 当type=3时，对应实体id
     */
    private Long entityId;

    /**
     * 当type=3时，对应实体的编码
     */
    private String entityCode;

    /**
     * 当type=3时，匹配的实体值
     */
    private String entityValue;

    /**
     * 子话术次序号
     */
    private Integer callNum;

    /**
     * 子话术内部次序号：从小到大
     */
    private Integer sortNum;

    public TextReplyDetail(Long detailId, Long replyId, Integer type, Integer contentType,
                           String content, Long variableId, Long entityId, Integer callNum, Integer sortNum) {
        this.detailId = detailId;
        this.replyId = replyId;
        this.type = type;
        this.contentType = contentType;
        this.content = content;
        this.variableId = variableId;
        this.entityId = entityId;
        this.callNum = callNum;
        this.sortNum = sortNum;
    }

    public boolean isVariable() {
        return Objects.equals(type, 2);
    }

    public boolean isEntity() {
        return Objects.equals(type, 3);
    }
}
